<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">新手引导分数据统计</ui:define>
    <ui:define name="content">


        <h:form>
            <p:dialog header="操作执行中,请稍候" widgetVar="doing" modal="true" closable="false" resizable="false"
                      draggable="false"/>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix" style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"/>
                        <p:columnToggler datasource="statisticRecordDataTable" trigger="toggler"/>
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         onstart="PF('doing').show()"
                                         update="@form"/>
                        <p:commandButton value="重置" actionListener="#{noviceDetailStatBean.onReset()}" icon="fa fa-refresh"
                                         process="@this" update="@form"/>
                        <p:commandButton value="导出" icon="fa fa-download"
                                         ajax="false">
                            <p:dataExporter type="xls" target="statisticRecordDataTable" fileName="export"/>
                        </p:commandButton>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-g ui-fluid" style="padding-top: 30px;">
                <div class="ui-g-12">
                    <div class="ui-g-12 card">
                        <h1>查询条件</h1>
                        <div class="ui-g-1">
                            <p:outputLabel value="产品"/>
                        </div>
                        <div class="ui-g-3">
                            <p:selectOneMenu id="productId" value="#{noviceDetailStatBean.$.productId}" filter="true"
                                             filterMatchMode="contains">
                                <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                              noSelectionOption="true"/>
                                <f:selectItems
                                        value="#{noviceDetailStatBean.commProductIds}"
                                        var="product"
                                        itemLabel="#{product.name}" itemValue="#{product.productId}"/>
                            </p:selectOneMenu>
                        </div>
                        <div class="ui-g-1">
                            <p:outputLabel value="渠道"/>
                        </div>
                        <div class="ui-g-3">
                            <p:selectOneMenu id="channel" value="#{noviceDetailStatBean.$.channel}" filter="true"
                                             filterMatchMode="contains">
                                <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                              noSelectionOption="true"/>
                                <f:selectItems
                                        value="#{noviceDetailStatBean.commProductChannels}"
                                        var="channel"
                                        itemLabel="#{channel.channelName}" itemValue="#{channel.channelCode}"/>
                            </p:selectOneMenu>
                        </div>
                        <div class="ui-g-1">
                            <p:outputLabel value="平台"/>
                        </div>
                        <div class="ui-g-3">
                            <p:selectOneMenu id="platform" value="#{noviceDetailStatBean.$.platform}">
                                <f:selectItem itemLabel="- 请选择 -" itemValue=""/>
                                <f:selectItem itemLabel="android" itemValue="android"/>
                                <f:selectItem itemLabel="ios" itemValue="ios"/>
                            </p:selectOneMenu>
                        </div>
                        <div class="ui-g-12"></div>
                        <div class="ui-g-1">
                            <p:outputLabel value="甲方类型"/>
                        </div>
                        <div class="ui-g-3">
                            <p:selectOneMenu id="partyType" value="#{noviceDetailStatBean.$.partyType}">
                                <f:selectItem itemLabel="- 请选择 -" itemValue=""/>
                                <f:selectItem itemLabel="H5" itemValue="1" />
                            </p:selectOneMenu>
                        </div>
                        <div class="ui-g-1">
                            <p:outputLabel value="活动名"/>
                        </div>
                        <div class="ui-g-3">
                            <p:selectOneMenu id="activityId" value="#{noviceDetailStatBean.$.activityId}" filter="true"
                                             filterMatchMode="contains">
                                <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                              noSelectionOption="true"/>
                                <f:selectItems value="#{noviceDetailStatBean.productInfoList}"
                                               var="product"
                                               itemLabel="#{product.name}" itemValue="#{product.id}"/>
                            </p:selectOneMenu>
                        </div>

                        <div class="ui-g-1">
                            <p:outputLabel value="时间"/>
                        </div>
                        <div class="ui-g-3">
                            <p:calendar
                                    id="startTime" styleClass="autoWidthCalendar"
                                    value="#{noviceDetailStatBean.$.startTime}"
                                    locale="#{constants:get('LOCALE')}"
                                    timeZone="#{constants:get('TIME_ZONE')}"
                                    pattern="#{constants:get('DATE_FORMAT')}"/>
                            <span>—</span>
                            <p:calendar
                                    id="endTime" styleClass="autoWidthCalendar"
                                    value="#{noviceDetailStatBean.$.endTime}"
                                    locale="#{constants:get('LOCALE')}"
                                    timeZone="#{constants:get('TIME_ZONE')}"
                                    pattern="#{constants:get('DATE_FORMAT')}"/>
                        </div>

                    </div>


                    <div class="ui-g-12 card">
                        <p:dataTable id="statisticRecordDataTable"
                                     style="width: 100%;text-align:center"
                                     var="detailRecord"
                                     value="#{noviceDetailStatBean.lazyDataModel}"
                                     rows="#{constants:get('ROWS')}"
                                     lazy="true"
                                     paginator="true"
                                     paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                     rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                     emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                     scrollable="true"
                                     scrollWidth="97%"
                                     reflow="true"
                                     selection=""
                                     resizableColumns="true">
                            <p:column headerText="时间">
                                <h:outputText value="#{detailRecord.createDate}"/>
                            </p:column>
                            <p:column headerText="产品" style="text-align:center;">
                                <h:outputText value="#{detailRecord.productName}"/>
                            </p:column>
                            <p:column headerText="渠道" style="text-align:center;">
                                <h:outputText value="#{detailRecord.channelName}"/>
                            </p:column>
                            <p:column headerText="平台" style="text-align:center;">
                                <h:outputText value="#{detailRecord.platform}"/>
                            </p:column>
                            <p:column headerText="甲方名称" style="text-align:center;">
                                <h:outputText value="#{detailRecord.activityName}"/>
                            </p:column>
                            <p:column headerText="甲方类型" style="text-align:center;">
                                <h:outputText value="#{detailRecord.partyName}"/>
                            </p:column>
                            <p:column headerText="主动投递提单" style="text-align:center;">
                                <h:outputText value="#{detailRecord.initiativeCount}"/>
                            </p:column>
                            <p:column headerText="生成订单数" style="text-align:center;">
                                <h:outputText value="#{detailRecord.orderCount}"/>
                            </p:column>
                        </p:dataTable>
                    </div>

                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>